package io.homework3;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("pw1.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner sc = new Scanner(System.in);

        while (true){
            System.out.println("请输入：");
            String s = sc.next();
            if ("exit".equals(s)){
                break;
            }
            pw.println(s);
        }
        pw.close();
        System.out.println("写出完成");
    }
}
